\\ Written by Donald T. Becker (dtbecker@prolog.net) IRC: StarDustr
// Please mail any bug reports/comments to the above address with a subject
\\ header of MCF_Buttons
//
\\ This script uses 2 ports:
// PLUGG and PLUGR
\\
// ** What to do with this file?
\\ Put this script in AmIRC directory along with icon.
*/
;if ~show('L',"rexxsupport.library") then;do;if ~addlib("rexxsupport.library",0,-30,0) then;do;say '"rexxsupport.library Open Failure. EOJ."';address PLUGG 'QUIT';exit;end;end;if ~openport(PLUGR) then;do;say '"PLUGR OpenPort failure. EOJ."';address PLUGG 'QUIT';exit;end;BDir="Ram:";PDir="Ram:";Application_AboutMUI=0x8042d21d;Application_Load=0x8042f90d;Application_OpenConfigWindow=0x804299ba;List_Clear=0x8042ad89;Menuitem_Shortcut=0x80422030;Menuitem_Title=0x804218be;MUIA_Group_ActivePage=0x80424199;MUIA_Weight=0x80421d1f;Set=0x8042549a;address PLUGG;window ID PLUGW COMMAND '"call QuitPort()"' PORT PLUGR;menu LABEL '"Install_PlugIns"';item COMMAND '"HIDE"' PORT PLUGG ATTRS Menuitem_Shortcut '"I"' LABEL '"Iconify"';item COMMAND '"method 'Application_AboutMUI' 0"' PORT PLUGG LABEL '"About MUI"';menu LABEL '"Settings"';item COMMAND '"method 'Application_OpenConfigWindow'"' PORT PLUGG LABEL '"MUI..."';endmenu;item ATTRS Menuitem_Title '"-1"';item COMMAND '"call QuitPort()"' PORT PLUGR ATTRS Menuitem_Shortcut '"Q"' LABEL '"Quit"';endmenu;group ID REGF REGISTER LABELS "Control,Buttons,PlugIns,List";group;text ID TXT0 LABEL "\n Welcome to StarDustr's PlugIn \n Utility for MCF_Buttons.\n\n Version: 5.0 (27.03.97)\n\n\n";space;text LABEL "\n Select Function to Perform\n";group HORIZ;group;space;button COMMAND '"call DoMore(A)"' PORT PLUGR label "Add";button COMMAND '"call DoMore(D)"' PORT PLUGR label "Remove";endgroup;group;space;button COMMAND '"call DoMore(R)"' PORT PLUGR label "Replace";button COMMAND '"call QuitPort()"' PORT PLUGR label "Exit";endgroup;endgroup;endgroup;group;text ID TXT1 LABEL "\n\n\n Control Function not Selected.\n\n\n";group HORIZ;volumelist COMMAND '"1 V %s"' PORT PLUGR ATTRS MUIA_Weight 20;dirlist ID LST1 PRESS COMMAND '"1 D %s"' PORT PLUGR ATTRS MUIA_Weight 80 PATH BDir PATTERN "MCF.Buttons";endgroup;endgroup;group;text ID TXT2 LABEL "\n\n\n Control Function not Selected.\n\n\n";group HORIZ;volumelist COMMAND '"2 V %s"' PORT PLUGR ATTRS MUIA_Weight 20;dirlist ID LST2 PRESS COMMAND '"2 D %s"' PORT PLUGR ATTRS MUIA_Weight 80 PATH PDir;endgroup;endgroup;group;text ID TXT3 LABEL "\n\n\n Control Function not Selected.\n\n\n";list ID LST3 COMMAND "%s" PORT PLUGR;endgroup;endgroup;endwindow;method Application_Load 0;Stage1:;call waitpkt(PLUGR);xx=getpkt(PLUGR);if xx='00000000'x then signal Stage1;Stg1=getarg(xx);call reply(xx);parse value Stg1 with Sfunc Scmd Sarg junk;dirlist ID LST1 PATH BDir PATTERN "MCF.Buttons";dirlist ID LST2 PATH PDir;DoCalls:;if upper(Sfunc)="CALL" then interpret Stg1;method ID REGF Set MUIA_Group_ActivePage '"0"';signal Stage1;DoMore:;arg Sfunc junk;select;when Sfunc='A' then;do;text ID TXT1 LABEL "\n\n Select your MCF.Buttons file \n that you wish to Add to.\n\n";text ID TXT2 LABEL "\n\n\n Buttons Selection not Completed. \n\n\n";text ID TXT3 LABEL "\n\n\n Buttons Selection not Completed. \n\n\n";method ID REGF Set MUIA_Group_ActivePage '"-4"';call GetBFile();text ID TXT1 LABEL "\n\n\n Buttons File Selected. \n\n\n";text ID TXT2 LABEL "\n\n Select PlugIn to be \n Inserted into MCF.Buttons.";text ID TXT3 LABEL "\n\n\n PlugIn Selection not Completed. \n\n\n";method ID REGF Set MUIA_Group_ActivePage '"-4"';call GetPFile();if 0 ~=pos('# AMIRC',upper(Pline.1)) then;text ID TXT0 LABEL "\n Welcome to StarDustr's PlugIn \n Utility for MCF_Buttons.\n\n Version: 5.0 (27.03.97)\n\n I CAN'T DO THAT!!!\n";else;do;text ID TXT2 LABEL "\n\n PlugIn File Selected. \n\n\n";text ID TXT3 LABEL "\n\n Select Page Label that \n you wish to Add after.";method ID REGF Set MUIA_Group_ActivePage '"-4"';call GetList();call AddPlug();text ID TXT0 LABEL "\n Welcome to StarDustr's PlugIn \n Utility for MCF_Buttons.\n\n Version: 5.0 (27.03.97)\n\n PlugIn has been Added.\n";end;text ID TXT1 LABEL "\n\n\n Control Function not Selected.\n\n\n";text ID TXT2 LABEL "\n\n\n Control Function not Selected.\n\n\n";text ID TXT3 LABEL "\n\n\n Control Function not Selected.\n\n\n";method ID LST3 List_Clear;method ID REGF Set MUIA_Group_ActivePage '"0"';end;when Sfunc='D' then;do;text ID TXT1 LABEL "\n\n Select your MCF.Buttons file \n that you wish to Remove from.\n\n";text ID TXT2 LABEL "\n\n\n This Page NOT Used for Removes. \n\n\n";text ID TXT3 LABEL "\n\n\n Buttons Selection not Completed. \n\n\n";method ID REGF Set MUIA_Group_ActivePage '"-4"';call GetBFile();text ID TXT1 LABEL "\n\n\n Buttons File Selected. \n\n\n";text ID TXT3 LABEL "\n\n Select Page Label that \n you wish to Remove.";method ID REGF Set MUIA_Group_ActivePage '"-1"';call GetList();if 0 ~=pos('AMIRC',upper(Stg1)) then;text ID TXT0 LABEL "\n Welcome to StarDustr's PlugIn \n Utility for MCF_Buttons.\n\n Version: 5.0 (27.03.97)\n\n I CAN'T DO THAT!!!\n";else;do;call DelPlug();text ID TXT0 LABEL "\n Welcome to StarDustr's PlugIn \n Utility for MCF_Buttons.\n\n Version: 5.0 (27.03.97)\n\n PlugIn has been Removed.\n";end;text ID TXT1 LABEL "\n\n\n Control Function not Selected.\n\n\n";text ID TXT2 LABEL "\n\n\n Control Function not Selected.\n\n\n";text ID TXT3 LABEL "\n\n\n Control Function not Selected.\n\n\n";method ID LST3 List_Clear;method ID REGF Set MUIA_Group_ActivePage '"0"';end;when Sfunc='R' then;do;text ID TXT1 LABEL "\n\n Select your MCF.Buttons file \n that you wish to Add to.\n\n";text ID TXT2 LABEL "\n\n\n Buttons Selection not Completed. \n\n\n";text ID TXT3 LABEL "\n\n\n Buttons Selection not Completed. \n\n\n";method ID REGF Set MUIA_Group_ActivePage '"-4"';call GetBFile();text ID TXT1 LABEL "\n\n\n Buttons File Selected. \n\n\n";text ID TXT2 LABEL "\n\n Select PlugIn to be \n Inserted into MCF.Buttons.";method ID REGF Set MUIA_Group_ActivePage '"-4"';call GetPFile();text ID TXT2 LABEL "\n\n PlugIn File Selected. \n\n\n";text ID TXT3 LABEL "\n\n Select Page Label that \n you wish to Replace.";method ID REGF Set MUIA_Group_ActivePage '"-4"';call GetList();if (0=pos('AMIRC',upper(Stg1))&0 ~=pos('# AMIRC',upper(Pline.1)))|(0 ~=pos('AMIRC',upper(Stg1))&0=pos('# AMIRC',upper(Pline.1))) then;text ID TXT0 LABEL "\n Welcome to StarDustr's PlugIn \n Utility for MCF_Buttons.\n\n Version: 5.0 (27.03.97)\n\n I CAN'T DO THAT!!!\n";else;do;call RepPlug();text ID TXT0 LABEL "\n Welcome to StarDustr's PlugIn \n Utility for MCF_Buttons.\n\n Version: 5.0 (27.03.97)\n\n PlugIn has been Replaced.\n";end;text ID TXT1 LABEL "\n\n\n Control Function not Selected.\n\n\n";text ID TXT2 LABEL "\n\n\n Control Function not Selected.\n\n\n";text ID TXT3 LABEL "\n\n\n Control Function not Selected.\n\n\n";method ID LST3 List_Clear;method ID REGF Set MUIA_Group_ActivePage '"0"';end;end;return;GetBFile:;call waitpkt(PLUGR);xx=getpkt(PLUGR);if xx='00000000'x then signal GetBFile;Stg1=getarg(xx);call reply(xx);parse value Stg1 with Sfunc Scmd Sarg junk;if upper(Sfunc)="CALL" then signal DoCalls;if Sfunc ~='1' then signal GetBFile;if Scmd='V' then;do;Address PLUGG dirlist ID LST1 PATH Sarg PATTERN "MCF.Buttons";signal GetBFile;end;parse value statef(Sarg) with ftype junk;if ftype='DIR' then;do;Address PLUGG dirlist ID LST1 PATH Sarg;signal GetBFile;end;BFile=Sarg;slp=lastpos('/',Sarg);clp=lastpos(':',Sarg);if slp>clp then;BDir=left(Sarg,slp-1);else BDir=left(Sarg,clp);if ~open("In",BFile) then;do;say "Error Ocurred Opening" BFile "for Processing. EOJ!";signal QuitPort;end;AllPages="";do cntr=1 by 1 until eof("In");Mline.cntr=readln("In");if Mline.cntr="" then;do;cntr=cntr-1;iterate cntr;end;if 1=pos('#',Mline.cntr) then;do;parse value Mline.cntr with junk xpage;xpage=strip(xpage);if left(xpage,3)="END" then iterate cntr;if left(xpage,3)="WWW" then iterate cntr;AllPages=AllPages xpage;list ID LST3 POS '"-3"' UPDATE INSERT STRING xpage;end;end cntr;call close("In");return;GetPFile:;call waitpkt(PLUGR);xx=getpkt(PLUGR);if xx='00000000'x then signal GetPFile;Stg1=getarg(xx);call reply(xx);parse value Stg1 with Sfunc Scmd Sarg junk;if upper(Sfunc)="CALL" then signal DoCalls;if Sfunc ~='2' then signal GetPFile;if Scmd='V' then;do;Address PLUGG dirlist ID LST2 PATH Sarg;signal GetPFile;end;parse value statef(Sarg) with ftype junk;if ftype='DIR' then;do;Address PLUGG dirlist ID LST2 PATH Sarg;signal GetPFile;end;PFile=Sarg;slp=lastpos('/',Sarg);clp=lastpos(':',Sarg);if slp>clp then;PDir=left(Sarg,slp-1);else PDir=left(Sarg,clp);if ~open("In",PFile) then;do;say "Error Ocurred Opening" PFile "for Processing. EOJ!";signal QuitPort;end;do cntp=1 by 1 while ~eof("In");Pline.cntp=readln("In");if Pline.cntp="" then;do;cntp=cntp-1;iterate cntp;end;end cntp;cntp=cntp-1;call close("In");return;GetList:;call waitpkt(PLUGR);xx=getpkt(PLUGR);if xx='00000000'x then signal GetList;Stg1=getarg(xx);call reply(xx);parse value Stg1 with Sfunc junk;if upper(Sfunc)="CALL" then signal DoCalls;if 0=pos(Stg1,AllPages) then signal GetList;return;AddPlug:;if ~open("Out",BFile,"w") then;do;say "Error Ocurred Opening" BFile "for Writing. EOJ!";signal QuitPort;end;Stg1="#" Stg1;do cnt1=1 by 1 while 0=pos(Stg1,Mline.cnt1);call writeln("Out",Mline.cnt1);end cnt1;call writeln("Out",Mline.cnt1);cnt1=cnt1+1;do cnt2=cnt1 by 1 while '#' ~=left(Mline.cnt2,1);call writeln("Out",Mline.cnt2);end cnt2;do cnt3=1 to cntp;call writeln("Out",Pline.cnt3);end cnt3;do cnt4=cnt2 to cntr;call writeln("Out",Mline.cnt4);end cnt4;call close("Out");return;DelPlug:;if ~open("Out",BFile,"w") then;do;say "Error Ocurred Opening" BFile "for Writing. EOJ!";signal QuitPort;end;Stg1="#" Stg1;do cnt1=1 by 1 while 0=pos(Stg1,Mline.cnt1);call writeln("Out",Mline.cnt1);end cnt1;do cnt2=cnt1+1 by 1 while '#' ~=left(Mline.cnt2,1);end cnt2;do cnt3=cnt2 to cntr;call writeln("Out",Mline.cnt3);end cnt3;call close("Out");return;RepPlug:;if ~open("Out",BFile,"w") then;do;say "Error Ocurred Opening" BFile "for Writing. EOJ!";signal QuitPort;end;Stg1="#" Stg1;do cnt1=1 by 1 while 0=pos(Stg1,Mline.cnt1);call writeln("Out",Mline.cnt1);end cnt1;do cnt2=cnt1+1 by 1 while '#' ~=left(Mline.cnt2,1);end cnt2;do cnt3=1 to cntp;call writeln("Out",Pline.cnt3);end cnt3;do cnt4=cnt2 to cntr;call writeln("Out",Mline.cnt4);end cnt4;call close("Out");return;QuitPort:;call closeport(PLUGR);address PLUGG 'QUIT';exit